truststore.js ➔ parseCertFromBase64   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
nc 1
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
nop 1
1 1
var jsrsasign = require('jsrsasign');
2
3
function parseCertFrom(string, encoding) {
4 136
    var cert = new jsrsasign.X509();
5 136
    cert.readCertHex(Buffer.from(string, encoding).toString('hex'));
0 ignored issues
show
Bug introduced by
The variable Buffer seems to be never declared. If this is a global, consider adding a /** global: Buffer */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
6 136
    return cert;
7
}
8
9
function parseCertFromBase64(string) {
10 136
    return parseCertFrom(string, 'base64');
11
}
12
13 1
var certificates = require('./ca-certificates.json');
14 1
var store = [];
15 1
Object.keys(certificates).map(function(key) {
16 136
    store.push(parseCertFromBase64(certificates[key]));
17
});
18
19
module.exports = store;
20